<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src='../js/vue.js'>
  </script>
</head>

<body>

  <div id=app>
  </div>
  <script type='text/javascript'>

    let number = 18;
    let person = {
      name: '张三',
      sex: '男'
    }

    Object.defineProperty(person, 'age', {
      // value: 19,
      // enumerable: true,  //可以枚举
      // writable: true,   //可以修改
      // configurable: true   //可以删除

      //当获取age，调用该函数
      get() {
        return number;
      },
      set(value) {
        number = value;
      }

    })
    console.log(person);

  </script>
</body>

</html>